package com.loft.threadtask.renren;

import com.loft.R;
import com.loft.comm.MyApp;
import com.loft.model.innerface.HTTPServiceController;

import android.R.integer;
import android.app.Dialog;
import android.content.Context;
import android.os.AsyncTask;

/**
 * @author heb
 * @class_name getUserInfoAsynctask.java
 * @create_date 2012/05/14
 * @version 1.0.0
 */
public class UserInfoAsynctask extends AsyncTask<String, Object, Object> {
	private Context _context;
	private int _thread_flag;
	private Dialog _dialog;

	public UserInfoAsynctask(Context context, int thread_flag, Dialog dialog) {
		this._context = context;
		this._thread_flag = thread_flag;
		this._dialog = dialog;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.os.AsyncTask#doInBackground(Params[])
	 */
	@Override
	protected Object doInBackground(String... params) {
		switch (_thread_flag) {
		case R.id.thread_flag_userinfo_get:
			HTTPServiceController ConnectionContext = new HTTPServiceController(
					MyApp.ACTIVITY_NAME_GETUSERINFO, null);
			return ConnectionContext.doConnect();
		default:
			break;
		}
		return null;
	}

	@Override
	protected void onPostExecute(Object result) {
		if (result == null) {
			_dialog.cancel();
		}
		super.onPostExecute(result);
	}

}
